package me.caofeng.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.ibatis.annotations.Param;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.pojo
 * @Description:
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-06-19 1:01
 * @Version: V1.0
 */
public class SmsCode {

    @NotNull(message = "手机号不能为空")
    @Pattern(regexp = "^((13[0-9])|(14[5|7|9])|(15([0-3]|[5-9]))|(17[0|5|6|7|8|])|(18[0-9]))\\d{8}$",
            message = "手机号格式错误")
    private String phone;

    @NotNull
    @Pattern(regexp = "\\d{4}",message = "验证码格式错误")
    private String code;

    private Integer count;

    public SmsCode() {
    }

    public SmsCode(String phone, String code, Integer count) {
        this.phone = phone;
        this.code = code;
        this.count = count;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @JsonIgnore
    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "SmsCode{" +
                " phone ='" + phone + '\'' +
                ", code=" + code +
                '}';
    }
}
